package org.cainiao.notebook.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.cainiao.api.lark.dto.response.docs.space.folder.LarkFilePage;
import org.cainiao.notebook.entity.Note;

import java.io.Serial;

/**
 * <br />
 * <p>
 * Author: Cai Niao(wdhlzd@163.com)<br />
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Schema(name = "LarkFolderNote", description = "飞书文件夹类型的笔记")
public class LarkFolderNote extends Note {

    @Serial
    private static final long serialVersionUID = -9090803763651185697L;

    LarkFilePage files;

    public static LarkFolderNote fromNote(Note note, LarkFilePage larkPage) {
        return LarkFolderNote.builder()
            .parentId(note.getParentId())
            .id(note.getId())
            .type(note.getType())
            .externalId(note.getExternalId())
            .files(larkPage)
            .build();
    }
}
